<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="haha">haha</div>
    <script>
        //添加
        let box = document.createElement('div')
        let haha = document.querySelector('.haha')
        box.style.width = '200px'
        box.style.height = '200px'
        box.style.backgroundColor = 'pink'


        document.body.insertBefore(box, haha)

        //克隆
        let box2 = box.cloneNode(true)
        document.body.appendChild(box2)

        //删除
        document.body.removeChild(box2)
    </script>
</body>

</html>